package ferp.android.widgets.buttons.suit;

import android.content.Context;
import android.util.AttributeSet;
import ferp.android.R;
import ferp.core.card.Card;
import ferp.core.game.Bid;
import ferp.core.game.Game;

/**
* User: igorgok
* Date: 1/6/14 5:12 PM
*/
public class SuitButtonDown extends SuitButton
{
  public SuitButtonDown(Context context) {super(context);}
  public SuitButtonDown(Context context, AttributeSet attrs) {super(context, attrs);}
  public SuitButtonDown(Context context, AttributeSet attrs, int defStyle) {super(context, attrs, defStyle);}

  @Override
  protected boolean getEnabledState(Game g, Bid bid)
  {
    return bid.tricks > g.bid.tricks && bid.trump.ordinal() > Card.Suit.SPADES.ordinal() ||
           bid.trump.ordinal() > g.bid.trump.ordinal();
  }

  @Override
  protected Card.Suit getSuitToShow(Game g, Bid bid)
  {
    return bid.trump.ordinal() > Card.Suit.SPADES.ordinal() ? Card.Suit.previous(bid.trump) : null;
  }

  @Override
  protected int getButtonBackgroundResource()
  {
    return R.drawable.selector_button_suit_down;
  }
}
